package com.mt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mt.pojo.OrderInfo;
import com.mt.pojo.CinemaSeat;
import com.mt.vo.OrderListVO;
import com.mt.pojo.Ticket;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Wang
 * @since 2020-12-28
 */
@Mapper
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {

    List<Ticket> existTicket(@Param("scheduleId") int scheduleId, @Param("seatList") List<CinemaSeat> seatList);

    List<Integer> getSoldTickets(@Param("scheduleId") int scheduleId);

    List<OrderListVO> listOrderByUser(@Param("userId") String userId);

    List<OrderListVO> pageOrder(IPage<OrderListVO> page,
                                @Param("filmName") String filmName,
                                @Param("cinemaId") int cinemaId);

    Ticket getTicketOrderDetail(@Param("orderId") Integer orderId);

    boolean BatchInsertTicket(@Param("orderId") Long orderId,
                              @Param("userId") String userId,
                              @Param("scheduleId") int scheduleId,
                              @Param("seatList") List<CinemaSeat> seatList);

    boolean cancelOrderSeats(@Param("orderId") Long orderId);

    boolean cancelOrder(@Param("orderId") Long orderId);

    boolean confirmOrder(@Param("orderId") Long orderId);
}
